home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 9 / litebar.zip / LITE5.PRG next >
Text File  |  1991-08-12  |  25KB  |  759 lines

  1. *-------------------------------------------------------------------------------
  2. *-- Program...: LITE5.PRG 
  3. *-- Programmer: Ken Mayer
  4. *-- Date......: 7/17/91 
  5. *-- Notes.....: The dBASE Menus are fine to a point, but there are times when
  6. *--             you may need a LOT of menu pads. This program is designed to
  7. *--             allow up to 60 menu items, although you can, if you desire,
  8. *--             set up some options as headers (these will not be chooseable
  9. *--             by the user), and you can set up conditions where an option
  10. *--             may be skipped. This routine is the original program, created
  11. *--             for my fantasy gaming procedures. It allows a user to choose
  12. *--             an item once (for you gamers, this is part of a character
  13. *--             generation routine -- when creating a character, the character
  14. *--             may improve certain skills once only ... (that's for the
  15. *--             creation ... in the update routines that option will be removed)
  16. *--             -- the user knows he's chosen that item before because the
  17. *--             color changes ...
  18. *--             Original concept by FELIXR, but I ran with it and programmed
  19. *--             it up ... As a programmer, the following procedures will need
  20. *--             to be modified:
  21. *--                REFRESH   --  description of each litebar
  22. *--                LOADARRAY --  load the arrays ... there are some items
  23. *--                              that will need changing
  24. *--                DOCHOICE  --  this is where the user choice is made ...
  25. *--                VALID     --  validation of litebars ...
  26. *--             Other items needing changing are noted in comments.
  27. *-------------------------------------------------------------------------------
  28. cTalk   = set("TALK")
  29. set talk off 
  30. cStatus = set("STATUS")
  31. set stat off    && just making sure
  32. cEscape = set("ESCAPE")
  33. set escape off  && for use with INKEY()
  34. cCursor = set("CURSOR")
  35. set cursor off
  36.  
  37. set procedure to proc   && contains a few routines like YESNO ...
  38. clear                   && clear screen completely for this ...
  39. ?scrnhead("rg+/gb","Character Skills")
  40.  
  41. public literow,litecol,choice,lastcol,lastrow,gl_error  && global memvars
  42.   *-- literow = row position
  43.   *-- litecol = column -- used together to hold real positions
  44.   *-- choice  = user entry (up, down, right, left, <Enter>, <Esc>
  45.   *-- lastcol = last column -- entered in REFRESH routine
  46.   *-- lastrow = last row    -- ditto
  47.  
  48. ln_max = 60              && max entries
  49. choice = 0               && init choice so it's numeric ...
  50.  
  51. public skill,lite_bar,pos1,pos2,skil_flag,skip,heading  && arrays
  52. declare skill[ln_max],pos1[15],pos2[4],lite_bar[15,4],skil_flag[15,4]
  53. declare skip[15,4],heading[15,4]
  54.   *-- skill[x]      = value we're obtaining from user ...
  55.   *-- pos1[x]       = position of choices on screen ... rows
  56.   *-- pos2[y]       = same ... columns
  57.   *-- lite_bar[x,y] = choices displayed on screen ...
  58.   *-- skil_flag[x,y]= flag for each choice ... once chosen can't choose again
  59.   *-- skip[x,y]     = flag to determine if we should skip an option ...
  60.   *-- heading[x,y]  = if it's a heading, we need to display in specific colors
  61.  
  62. *--------------------------------------------------------------------------
  63. * START processing here
  64. *--------------------------------------------------------------------------
  65.  
  66. do load_array   && procedure below to load values into arrays
  67.  
  68. *-- PROGRAMMER -- Make sure these are correct --*
  69. literow = 2     && starting coordinates
  70. litecol = 1     && ditto
  71. do scrnpnt      && paint the screen the first time .. the rest is handled
  72.                 && when the cursor is moved ...
  73.  
  74. *--------------------------------------------------------------------------
  75. * find out how many changes the user can make in beginning skills ...
  76. *--------------------------------------------------------------------------
  77.  
  78. if yesno(.t.,"Number of Changes Allowed","Do you want to roll the dice?","",;
  79.     "rg+/gb,n/w,rg+/gb")
  80.     ln_roll = validice(1,6,"Number of Changes","rg+/gb,n/g,rg+/gb")
  81. else
  82.     ln_roll = dice(6)
  83. endif  && yesno ...
  84. ln_numskills = ln_roll + 2
  85.  
  86. *--------------------------------------------------------------------------
  87. * loop until the user has done them all ...
  88. *--------------------------------------------------------------------------
  89.  
  90. do while ln_numskills > 0  && loop until user has modified all skills
  91.     
  92.     @1,60 say "Skills left: "+ltrim(str(ln_numskills)) color rg+/gb
  93.     choice = 0   && default it to 0, just to be safe ....
  94.     choice = inkey(0)
  95.     
  96.     *-- inkey() returns: 4 = right arrow
  97.     *--                 19 = left arrow
  98.     *--                  5 = up arrow
  99.     *--                 24 = down arrow
  100.     *--                 13 = <Enter>/Carriage Return
  101.     *--                 27 = <Esc>
  102.     *--                  2 = <End>
  103.     *--                 27 = <Home>
  104.     *  
  105.                         
  106.     do case
  107.         case choice = 4 .or. choice = 19
  108.             do movecol
  109.         case choice = 5 .or. choice = 24
  110.             do moverow
  111.         case choice = 2 .or. choice = 26
  112.             do HomeEnd
  113.         case choice = 13
  114.             do DoChoice
  115.             if .not. gl_error                && check to see if user chose wrong item
  116.                 ln_numskills = ln_numskills - 1  && decrement counter
  117.             endif
  118.     endcase
  119.     
  120. enddo  && loop and main procedure ...
  121.  
  122. *--------------------------------------------------------------------------
  123. *-- CLEANUP
  124. *--------------------------------------------------------------------------
  125. release literow,litecol,choice,lastcol,lastrow
  126. release pos1,pos2,lite_bar,skip,heading
  127. release skill,skil_flag    && these last two may need to be kept for my own
  128.                            && production version ... and NOT released ...
  129. set status &cStatus        && reset these if needed ...
  130. set talk   &cTalk
  131. set escape &cEscape
  132. set cursor &cCursor
  133. do Save_Array              && save the data in the SKILL[] array ...
  134.  
  135. RETURN                     && to calling program
  136.  
  137. *--------------------------------------------------------------------------
  138. * procedures here
  139. *--------------------------------------------------------------------------
  140.  
  141. PROCEDURE Load_Array
  142.  
  143.     *-- This will be replaced in my gaming programs to replace the
  144.     *-- contents of the SKILL[] array with fields from the database
  145.     *-- also load skil_name[] array from database ... (same way)
  146.     
  147.     ln_count = 0               && initialize "skill" array
  148.     ln_num = int(rand(-1) * 20) + 1
  149.     do while ln_count < ln_max
  150.         ln_count = ln_count + 1
  151.         skill[ln_count] = int(rand() * 20) + 1   && random number from 1 to 20
  152.     enddo
  153.  
  154.     *-- don't touch --*
  155.     ln_cnt1 = 0                && initialize the lightbar array ...
  156.     do while ln_cnt1 < 15
  157.         ln_cnt1 = ln_cnt1 + 1
  158.         ln_cnt2 = 0
  159.         do while ln_cnt2 < 4
  160.             ln_cnt2 = ln_cnt2 + 1
  161.             lite_bar[ln_cnt1,ln_cnt2] = space(1)  && init to a single space
  162.                                                   && character in it...
  163.             store .f. to skip[ln_cnt1,ln_cnt2]    && init to NO skip, but change
  164.                                                   && below as needed ...
  165.         enddo
  166.     enddo
  167.     
  168.     do Refresh   && this is used to setup the litebars ... and can be called
  169.                  && as a separate procedure from anywhere ...
  170.     
  171.     *-- this shouldn't need to be changed ...
  172.     *-- start at row six, allowing room at top of window/screen for headings
  173.     row1  =  6
  174.     row2  =  7
  175.     row3  =  8
  176.     row4  =  9
  177.     row5  = 10
  178.     row6  = 11
  179.     row7  = 12
  180.     row8  = 13
  181.     row9  = 14
  182.     row10 = 15
  183.     row11 = 16
  184.     row12 = 17
  185.     row13 = 18
  186.     row14 = 19
  187.     row15 = 20
  188.     
  189.     *-- set for four columns, up to 20 characters each -- column four should
  190.     *-- be kept down to 15 ... actually all of them should.
  191.     col1 = 5
  192.     col2 = 25
  193.     col3 = 45
  194.     col4 = 65
  195.     
  196.     *-- positions -- POS1 array is the row
  197.     pos1[1]  = row1
  198.     pos1[2]  = row2
  199.     pos1[3]  = row3
  200.     pos1[4]  = row4
  201.     pos1[5]  = row5
  202.     pos1[6]  = row6
  203.     pos1[7]  = row7
  204.     pos1[8]  = row8
  205.     pos1[9]  = row9
  206.     pos1[10] = row10
  207.     pos1[11] = row11
  208.     pos1[12] = row12
  209.     pos1[13] = row13
  210.     pos1[14] = row14
  211.     pos1[15] = row15
  212.     *-- positions -- POS2 array is the column
  213.     pos2[1]  = col1
  214.     pos2[2]  = col2
  215.     pos2[3]  = col3
  216.     pos2[4]  = col4
  217.     
  218. RETURN
  219. *-- EoP: Load_Array
  220.  
  221. *--------------------------------------------------------------------------
  222.  
  223. PROCEDURE Save_Array
  224.  
  225.     *-- procedure to save the contents of the SKILL[] array back to the
  226.     *-- database, otherwise all of this is pointless ...
  227.     
  228.  
  229. RETURN
  230. *-- EoP: Save_Array
  231.  
  232. *--------------------------------------------------------------------------
  233.  
  234. PROCEDURE Refresh 
  235.  
  236.     *-- PROGRAMMER CHANGES --*
  237.     
  238.     *-- this routine simply refreshes/defines the bars for the litebar 
  239.     *-- headings should define both SKIP and HEADING arrays as true for
  240.     *-- those entries, otherwise the program will allow them as "valid"
  241.     *-- choices. If you want to set up conditionals, this is the place
  242.     *-- to do it. You can do such things as:
  243.     *--    IF <condition>
  244.     *--       STORE .t. TO SKIP[x,y]
  245.     *--    ELSE
  246.     *--       STORE .f. TO SKIP[x,y]
  247.     *--    ENDIF
  248.     *-- this would replace the WHEN clause of the dbase popup BARs.
  249.     
  250.     lite_bar[1,1] = "HEADING 1"
  251.     store .t. to skip[1,1]     && don't allow as valid choice
  252.     store .t. to heading[1,1]  && for color display
  253.     lite_bar[2,1] = "Choice 1: "+ltrim(str(skill[1]))
  254.     lite_bar[3,1] = "Choice 2: "+ltrim(str(skill[2]))
  255.     *-- 4,1 = nothing -- blank
  256.     lite_bar[5,1] = "HEADING 2"
  257.     store .t. to skip[5,1]
  258.     store .t. to heading[5,1]
  259.     lite_bar[6,1] = "Choice 3: "+ltrim(str(skill[3]))
  260.     lite_bar[7,1] = "Choice 4: "+ltrim(str(skill[4]))
  261.     *-- column 2
  262.     lite_bar[1,2] = "HEADING 3"
  263.     store .t. to skip[1,2]
  264.     store .t. to heading[1,2]
  265.     lite_bar[2,2] = "Choice 5: "+ltrim(str(skill[5]))
  266.     lite_bar[3,2] = "Choice 6: "+ltrim(str(skill[6]))
  267.     lite_bar[4,2] = "Choice 7: "+ltrim(str(skill[7]))
  268.     store .t. to skip[4,2]
  269.     *-- 5,2 = nothing
  270.     lite_bar[6,2] = "HEADING 4"
  271.     store .t. to skip[6,2]
  272.     store .t. to heading[6,2]
  273.     lite_bar[7,2] = "Choice 8: "+ltrim(str(skill[8]))
  274.     *-- column 3
  275.     lite_bar[1,3] = "HEADING 5"
  276.     store .t. to skip[1,3]
  277.     store .t. to heading[1,3]
  278.     lite_bar[2,3] = "Choice  9: "+ltrim(str(skill[9]))
  279.     lite_bar[3,3] = "Choice 10: "+ltrim(str(skill[10]))
  280.     lite_bar[4,3] = "Choice 11: "+ltrim(str(skill[11]))
  281.     lite_bar[5,3] = "Choice 12: "+ltrim(str(skill[12]))
  282.     
  283.     *-- It is vital that these two items are set properly. If you have
  284.     *-- four columns, change lastcol to 4, and so on ...
  285.     lastcol = 3
  286.     lastrow = 7
  287.     
  288. RETURN
  289. *-- EoP: Refresh
  290.  
  291. *--------------------------------------------------------------------------
  292. PROCEDURE ScrnPnt  && procedure to paint the screen
  293.     
  294.     *-- this procedure will probably only be called once - at the beginning
  295.     *-- of the program. There should be no need for programmer modifications.
  296.     
  297.     ln_cnt = 0
  298.     do while ln_cnt < 15
  299.         ln_cnt = ln_cnt + 1
  300.         ln_cnt2 = 0
  301.         do while ln_cnt2 < 4
  302.             ln_cnt2 = ln_cnt2 + 1
  303.             if len(trim(lite_bar[ln_cnt,ln_cnt2])) > 0
  304.                 if heading[ln_cnt,ln_cnt2]
  305.                     @pos1[ln_cnt],pos2[ln_cnt2] say lite_bar[ln_cnt,ln_cnt2];
  306.                         color rg+/gb   && it's a heading
  307.                 else
  308.                     if skip[ln_cnt,ln_cnt2]  && it's not a heading, must not be
  309.                                              && allowed!
  310.                         @pos1[ln_cnt],pos2[ln_cnt2] say lite_bar[ln_cnt,ln_cnt2];
  311.                         color r/n  && color says it's not allowed!
  312.                     else  && normal item ...
  313.                         @pos1[ln_cnt],pos2[ln_cnt2] say lite_bar[ln_cnt,ln_cnt2]
  314.                     endif  && skip ...
  315.                 endif  && heading ...
  316.             endif  && len(trim...
  317.         enddo  && while ln_cnt2 ...
  318.     enddo  && while ln_cnt ...
  319.     
  320.     @pos1[2],pos2[1] say lite_bar[2,1] color n/g   
  321.         && display first bar higlighted
  322.     
  323.     do center with 23,80,"rg+/r","Press: "+chr(24)+chr(25)+chr(26)+chr(27)+;
  324.         ", <Home>, <End> to move, <Enter> to choose"
  325.     
  326. RETURN
  327. *-- EoP: ScrnPnt
  328.  
  329. *--------------------------------------------------------------------------
  330.  
  331. PROCEDURE MoveRow   && up/down arrows pressed
  332.     
  333.     *-- NO CHANGES NEEDED (in the next three procedures ... --*
  334.     
  335.     *-- this procedure handles up and down movement. It is designed to first,
  336.     *-- redisplay the current litebar area in "normal" color (default is
  337.     *-- whatever your screen/window NORMAL color is set to). Next, it looks
  338.     *-- at the keystroke, and moves the pointer to the next item. We check
  339.     *-- to see if that's valid (using VALID() below), and if it is, we are
  340.     *-- done. If it's not valid, we move in the direction (up/down) again,
  341.     *-- and check for valid, looping until we either find a valid option, or,
  342.     *-- if none of the options in that column are valid, we move to the
  343.     *-- next column. (Tricky, eh?) Once we have a valid position, we 
  344.     *-- display it highlighted, and return ...
  345.     if valid()
  346.         @pos1[literow],pos2[litecol] clear to pos1[literow],pos2[litecol]+19
  347.         if skil_flag[literow,litecol]  && if it's .t., display as RED on Black
  348.             @pos1[literow],pos2[litecol] say lite_bar[literow,litecol] color r/n
  349.         else                           && otherwise, display as normal ...
  350.             @pos1[literow],pos2[litecol] say lite_bar[literow,litecol] 
  351.         endif
  352.     endif && valid()
  353.     
  354.     do case
  355.         *-- uparrow first
  356.         case choice = 5 
  357.             
  358.             if literow = 1         && if first row
  359.                 literow = lastrow   && wrap it around ...
  360.             else
  361.                 literow = literow - 1   && decrement (move to next row)
  362.             endif
  363.             ln_count = 1           && set counter to 1
  364.             do while .not. valid() && function below to determine if lite_bar
  365.                                    && is valid
  366.                 ln_count = ln_count + 1   && if we're here, we're moving again
  367.                 if ln_count = lastrow     && we've wrapped around
  368.                     choice = 4             && stick a right arrow in here ...
  369.                     do movecol             && procedure to move cursor by col!
  370.                     exit                   && we're done here ...
  371.                 endif && ln_count = lastrow
  372.                 if literow = 1            && check for first row
  373.                     literow = lastrow      && wrap around
  374.                 else
  375.                     literow = literow - 1  && decrement (move to next)
  376.                 endif
  377.             enddo
  378.             
  379.         *-- down arrow next
  380.         case choice = 24
  381.     
  382.             if literow = lastrow   && if last row
  383.                 literow = 1         && wrap it around ...
  384.             else
  385.                 literow = literow + 1   && increment (move to next row)
  386.             endif
  387.             ln_count = 1           && set counter to 1
  388.             do while .not. valid() && function below to determine if lite_bar
  389.                                    && is valid
  390.                 ln_count = ln_count + 1   && if we're here, we're moving again
  391.                 if ln_count = lastrow     && we've wrapped around
  392.                     choice = 19            && stick a left arrow in here ...
  393.                     do movecol             && procedure to move cursor by col!
  394.                     exit                   && we're done here ...
  395.                 endif && ln_count = lastrow
  396.                 if literow = lastrow      && check for last row
  397.                     literow = 1            && wrap around
  398.                 else
  399.                     literow = literow + 1  && increment (move to next)
  400.                 endif
  401.             enddo
  402.             
  403.     endcase
  404.     
  405.     @pos1[literow],pos2[litecol] clear to pos1[literow],pos2[litecol]+19
  406.     @pos1[literow],pos2[litecol] say lite_bar[literow,litecol] color n/g
  407.         && display in hilight colors ...
  408.         
  409. RETURN
  410. *-- EoP: MoveRow
  411.  
  412. *--------------------------------------------------------------------------
  413.  
  414. PROCEDURE MoveCol   && left/right arrows pressed
  415.     
  416.     *-- See comments in MoveRow for an explanation of this.
  417.     
  418.     if valid()
  419.         @pos1[literow],pos2[litecol] clear to pos1[literow],pos2[litecol]+19
  420.         if skil_flag[literow,litecol]  && if it's .t., display as RED on Black
  421.             @pos1[literow],pos2[litecol] say lite_bar[literow,litecol] color r/n
  422.         else                           && otherwise, display as normal ...
  423.             @pos1[literow],pos2[litecol] say lite_bar[literow,litecol] 
  424.         endif
  425.     endif
  426.     
  427.     do case
  428.     
  429.         case choice = 4
  430.         ** right arrow
  431.             if litecol = lastcol   && if last column
  432.                 litecol = 1         && wrap it around ...
  433.             else
  434.                 litecol = litecol + 1   && increment (move to next column)
  435.             endif
  436.             ln_count = 1           && set counter to 1
  437.             do while .not. valid() && function below to determine if lite_bar
  438.                                    && is valid
  439.                 ln_count = ln_count + 1   && if we're here, we're moving again
  440.                 if ln_count = lastcol     && we've wrapped around
  441.                     choice = 24            && stick a down arrow in here ...
  442.                     do moverow             && procedure to move cursor by rows!
  443.                     exit                   && we're done here ...
  444.                 endif && ln_count = lastcol
  445.                 if litecol = lastcol      && check for last column
  446.                     litecol = 1            && wrap around
  447.                 else
  448.                     litecol = litecol + 1  && increment (move to next)
  449.                 endif
  450.             enddo
  451.             
  452.         *-- left arrow next
  453.         case choice = 19 
  454.     
  455.             if litecol = 1         && if FIRST column
  456.                 litecol = lastcol   && wrap it around ...
  457.             else
  458.                 litecol = litecol - 1   && decrement (move to next column)
  459.             endif
  460.             ln_count = 1           && set counter to 1
  461.             do while .not. valid() && function below to determine if lite_bar
  462.                                    && is valid
  463.                 ln_count = ln_count + 1   && if we're here, we're moving again
  464.                 if ln_count = lastcol     && we've wrapped around
  465.                     choice = 5             && stick an up arrow in here ...
  466.                     do moverow             && procedure to move cursor by rows!
  467.                     exit                   && we're done here ...
  468.                 endif && ln_count = lastcol
  469.                 if litecol = 1            && check for last column
  470.                     litecol = lastcol      && wrap around
  471.                 else
  472.                     litecol = litecol - 1  && decrement (move to next)
  473.                 endif
  474.             enddo
  475.     endcase
  476.     
  477.     @pos1[literow],pos2[litecol] clear to pos1[literow],pos2[litecol]+19
  478.     @pos1[literow],pos2[litecol] say lite_bar[literow,litecol] color n/g
  479.     
  480. RETURN
  481. *-- EoP: MoveCol
  482.  
  483. *--------------------------------------------------------------------------
  484.  
  485. PROCEDURE HomeEnd        && user pressed <Home> or <End>
  486.  
  487.     *-- Very much the same logic as MoveRow and MoveCol, but the
  488.     *-- cursor is moved to the first position (<Home>) or last (<End>) and
  489.     *-- validations is checked in those columns (moving to another column
  490.     *-- if really necessary).
  491.     
  492.     if valid()
  493.         @pos1[literow],pos2[litecol] clear to pos1[literow],pos2[litecol]+19
  494.         if skil_flag[literow,litecol]  && if it's .t., display as RED on Black
  495.             @pos1[literow],pos2[litecol] say lite_bar[literow,litecol] color r/n
  496.         else                           && otherwise, display as normal ...
  497.             @pos1[literow],pos2[litecol] say lite_bar[literow,litecol] 
  498.         endif
  499.     endif && valid()
  500.     
  501.     do case
  502.         *-- For HOME, we need to go to first position, and move down the column,
  503.         *-- as if we were doing the routine in MOVEROW ... for END we do the
  504.         *-- same, but go to last position, and work UP the column, looking for 
  505.         *-- valid ...
  506.         
  507.         case choice = 26
  508.         *-- <Home> key
  509.             litecol = 1            && move pointer to "Home" position
  510.             literow = 1
  511.             
  512.             ln_count = 1           && set counter to 1
  513.             do while .not. valid() && function below to determine if lite_bar
  514.                                    && is valid
  515.                 ln_count = ln_count + 1   && if we're here, we're moving again
  516.                 if ln_count = lastrow     && we've wrapped around
  517.                     choice = 4             && stick a right arrow in here ...
  518.                     do movecol             && procedure to move cursor by rows!
  519.                     exit                   && we're done here ...
  520.                 endif && ln_count = lastrow
  521.                 if literow = lastrow      && check for last column
  522.                     literow = 1            && wrap around
  523.                 else
  524.                     literow = literow + 1  && increment (move to next)
  525.                 endif
  526.             enddo
  527.         
  528.         case choice = 2
  529.             *-- <End> key
  530.             literow = lastrow      && move cursor to last item
  531.             litecol = lastcol
  532.             
  533.             ln_count = 1           && set counter to 1
  534.             do while .not. valid() && function below to determine if lite_bar
  535.                                    && is valid
  536.                 ln_count = ln_count + 1   && if we're here, we're moving again
  537.                 if ln_count = lastrow     && we've wrapped around
  538.                     choice = 19            && stick a left arrow in here ...
  539.                     do movecol             && procedure to move cursor by col!
  540.                     exit                   && we're done here ...
  541.                 endif && ln_count = lastrow
  542.                 if literow = 1            && check for first row
  543.                     literow = lastrow      && wrap around
  544.                 else
  545.                     literow = literow - 1  && increment (move to next)
  546.                 endif
  547.             enddo
  548.             
  549.     endcase
  550.     
  551.     @pos1[literow],pos2[litecol] clear to pos1[literow],pos2[litecol]+19
  552.     @pos1[literow],pos2[litecol] say lite_bar[literow,litecol] color n/g
  553.         && display in hilight colors ...
  554.  
  555. RETURN 
  556. *-- EoP: HomeEnd
  557.  
  558. *--------------------------------------------------------------------------
  559.  
  560. PROCEDURE DoChoice   && Determine what user has chosen to do, and do it.
  561.  
  562.     *-- PROGRAMMER CHANGES --*
  563.     
  564.     *-- This is where we go when the user has pressed <Enter>. It means
  565.     *-- they want to choose the highlighted option. The current structure
  566.     *-- below looks at the column, and then the row we are pointing to
  567.     *-- to decide what to do. Such options as  DO program  can be placed
  568.     *-- in the approprate cases ...
  569.     
  570.     *-- For this version, we set a value (skill number), and then use that
  571.     *-- in the SKILL[] Array. 
  572.     
  573.     *-- can this be done more efficiently? I can't think of a better
  574.     *-- way ... >sigh<.
  575.     
  576.     do case
  577.         case litecol = 1
  578.             do case
  579.                 case literow = 1
  580.                 
  581.                 case literow = 2
  582.                     sk_num = 1
  583.                 case literow = 3
  584.                     sk_num = 2
  585.                 case literow = 4
  586.                 
  587.                 case literow = 5
  588.                 
  589.                 case literow = 6
  590.                     sk_num = 3
  591.                 case literow = 7
  592.                     sk_num = 4
  593.                 case literow = 8
  594.                 
  595.                 case literow = 9
  596.                 
  597.                 case literow = 10
  598.                 
  599.                 case literow = 11
  600.                 
  601.                 case literow = 12
  602.                 
  603.                 case literow = 13
  604.                 
  605.                 case literow = 14
  606.                 
  607.                 case literow = 15
  608.                 
  609.             endcase
  610.         case litecol = 2
  611.             do case
  612.                 case literow = 1
  613.                 
  614.                 case literow = 2
  615.                     sk_num = 5
  616.                 case literow = 3
  617.                     sk_num = 6
  618.                 case literow = 4
  619.                     sk_num = 7
  620.                 case literow = 5
  621.                 
  622.                 case literow = 6
  623.                 
  624.                 case literow = 7
  625.                     sk_num = 8
  626.                 case literow = 8
  627.                 
  628.                 case literow = 9
  629.                 
  630.                 case literow = 10
  631.                 
  632.                 case literow = 11
  633.                 
  634.                 case literow = 12
  635.                 
  636.                 case literow = 13
  637.                 
  638.                 case literow = 14
  639.                 
  640.                 case literow = 15
  641.                 
  642.             endcase
  643.         case litecol = 3
  644.             do case
  645.                 case literow = 1
  646.                 
  647.                 case literow = 2
  648.                     sk_num = 9
  649.                 case literow = 3
  650.                     sk_num = 10
  651.                 case literow = 4
  652.                     sk_num = 11
  653.                 case literow = 5
  654.                     sk_num = 12
  655.                 case literow = 6
  656.                 
  657.                 case literow = 7
  658.                 
  659.                 case literow = 8
  660.                 
  661.                 case literow = 9
  662.                 
  663.                 case literow = 10
  664.                 
  665.                 case literow = 11
  666.                 
  667.                 case literow = 12
  668.                 
  669.                 case literow = 13
  670.                 
  671.                 case literow = 14
  672.                 
  673.                 case literow = 15
  674.                 
  675.             endcase
  676.         
  677.         case litecol = 4
  678.             do case
  679.                 case literow = 1
  680.             
  681.                 case literow = 2
  682.                 
  683.                 case literow = 3
  684.                 
  685.                 case literow = 4
  686.                 
  687.                 case literow = 5
  688.                 
  689.                 case literow = 6
  690.                 
  691.                 case literow = 7
  692.                 
  693.                 case literow = 8
  694.                 
  695.                 case literow = 9
  696.                 
  697.                 case literow = 10
  698.                 
  699.                 case literow = 11
  700.                 
  701.                 case literow = 12
  702.                 
  703.                 case literow = 13
  704.                 
  705.                 case literow = 14
  706.                 
  707.                 case literow = 15
  708.                 
  709.             endcase
  710.     endcase
  711.     
  712.     lc_skilname = substr(lite_bar[literow,litecol],1,;
  713.         at(":",lite_bar[literow,litecol])-1)  && get the skill name from the
  714.                                               && litebar ...
  715.     gl_error = .f.
  716.     if yesno(.t.,"&lc_skilname","Do you really want to modify",;
  717.         "&lc_skilname?","rg+/gb,n/g,rg+/gb")
  718.         if yesno(.t.,"&lc_skilname","Do you want to roll the dice?","",;
  719.             "rg+/gb,n/g,rg+/gb")
  720.             set cursor on
  721.             ln_roll = int(ValiDice(1,100,"","rg+/b,n/g,rg+/n") / 2)
  722.                 && get valid value from user and then cut it in half ...
  723.             set cursor off
  724.         else
  725.             ln_roll = int(Dice(100) / 2)  && roll it and cut value in half ...
  726.         endif
  727.     
  728.         skill[sk_num] = skill[sk_num] + ln_roll  && add this to it ...
  729.         store .t. to skil_flag[literow,litecol]  && don't allow this choice again ...
  730.         store .t. to skip[literow,litecol]  && SKIP this one next time around ...
  731.         do refresh                          && update the lite_bar array ...
  732.         @pos1[literow],pos2[litecol] clear to pos1[literow],pos2[litecol]+19
  733.         @pos1[literow],pos2[litecol] say lite_bar[literow,litecol] color r/n
  734.             && display option red on black ... so user KNOWS he's done it before.
  735.     
  736.     else        && user didn't want this 'un after all
  737.         
  738.         gl_error = .t.
  739.         
  740.     endif       && check to see if user wanted this one ...
  741.     
  742. RETURN
  743.  
  744. *--------------------------------------------------------------------------
  745.  
  746. FUNCTION Valid    && used to determine if the current litebar choice is valid
  747.  
  748.     if len(trim(lite_bar[literow,litecol])) > 0 .and. .not. skip[literow,litecol]
  749.         store .t. to lValid
  750.     else
  751.         store .f. to lValid
  752.     endif
  753.  
  754. RETURN lValid
  755.  
  756. *--------------------------------------------------------------------------
  757. * end of program: LITE4.prg
  758. *--------------------------------------------------------------------------
  759.